#include<iostream>
using namespace std;
typedef long long LL;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if (b - a == c - b && d - c == c - b) {
			int k = b - a;
			cout << a << " " << b << " " << c << " " << d << " " << (LL)d + k << endl;
		}
		else {
			int q = b / a;
			cout << a << " " << b << " " << c << " " << d << " " <<(LL) d * q << endl;
		}
	}
	return 0;
}